package biz.datalk.industrialland.admin.modules.system.pojo.dto;

import biz.datalk.industrialland.common.pojo.po.BasePO;
import biz.datalk.industrialland.common.validated.BatchDelete;
import biz.datalk.industrialland.common.validated.Insert;
import biz.datalk.industrialland.common.validated.Update;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * @author tarofang@163.com
 * @date 2019-08-19
 */
@Getter
@Setter
@ToString
public class SysRoleDTO extends BasePO implements Serializable {
    private static final long serialVersionUID = -6241090536986442668L;

    /**
     * 主键id, UUID
     */
    @EqualsAndHashCode.Include
    @NotNull(groups = Update.class, message = "{role.no.exists.or.delete}")
    private Long id;

    /**
     * 角色名称
     */
    @NotBlank(groups = {Insert.class, Update.class}, message = "{role.rolename.blank}")
    private String roleName;

    /**
     * 角色编码
     */
    @Pattern(regexp = "^(?!_)(?!.*?_$)[a-zA-Z0-9_]+$", message = "{role.rolecode.no.match.regex}")
    @NotBlank(groups = {Insert.class, Update.class}, message = "{role.rolecode.blank}")
    private String roleCode;

    /**
     * 描述
     */
    private String description;

    /**
     * 是否有效 N-无效 Y-有效
     */
    private String isValid;

    /**
     * 是否被删除 N-未删除 Y-已删除
     */
    private String isDelete;

    /**
     * 所属部门
     */
    private String sysOrgCode;


    @NotBlank(groups = BatchDelete.class, message = "{role.no.exists.or.delete}")
    private String sysids;
}
